﻿/*
 * User: RSny
 * Date: 5/10/2012
 * Time: 10:08 AM
 */
using System;
using System.Runtime.InteropServices;

namespace Aspects.Custom.Audio
{
	[StructLayout(LayoutKind.Sequential)]
	public struct WaveHeader
	{
		public IntPtr lpData; // pointer to locked data buffer
		public int dwBufferLength; // length of data buffer
		public int dwBytesRecorded; // used for input only
		public IntPtr dwUser; // for client's use
		public WaveHeaderFlags dwFlags; // assorted flags (see defines)
		public int dwLoops; // loop control counter
		public IntPtr lpNext; // PWaveHdr, reserved for driver
		public int reserved; // reserved for driver
	}
	
    /// <summary>
    /// Wave Header Flags enumeration
    /// </summary>
    [Flags]
    public enum WaveHeaderFlags
    {
        /// <summary>
        /// WHDR_BEGINLOOP
        /// This buffer is the first buffer in a loop.  This flag is used only with output buffers.
        /// </summary>
        BeginLoop = 0x00000004,
        /// <summary>
        /// WHDR_DONE
        /// Set by the device driver to indicate that it is finished with the buffer and is returning it to the application.
        /// </summary>
        Done = 0x00000001,
        /// <summary>
        /// WHDR_ENDLOOP
        /// This buffer is the last buffer in a loop.  This flag is used only with output buffers.
        /// </summary>
        EndLoop = 0x00000008,
        /// <summary>
        /// WHDR_INQUEUE
        /// Set by Windows to indicate that the buffer is queued for playback.
        /// </summary>
        InQueue = 0x00000010,
        /// <summary>
        /// WHDR_PREPARED
        /// Set by Windows to indicate that the buffer has been prepared with the waveInPrepareHeader or waveOutPrepareHeader function.
        /// </summary>
        Prepared = 0x00000002
    }
}